package com.xinxi11.module.core.web.freemarker;

import javax.servlet.ServletContext;

import org.apache.struts2.views.freemarker.FreemarkerManager;

import com.xinxi11.module.core.web.freemarker.function.MathAndFunction;
import com.xinxi11.module.core.web.freemarker.function.MathOrFunction;

import freemarker.template.Configuration;
import freemarker.template.TemplateException;

/**
 * freemarker 扩展汇总
 * 
 * @author 李国江
 * @date 2010-4-30
 */
public class ExtendedFreemarkerManager extends FreemarkerManager {
	@Override
	protected Configuration createConfiguration(ServletContext servletContext)
			throws TemplateException {
		Configuration configuration = super.createConfiguration(servletContext);
		configuration.setSharedVariable("mathOr", new MathOrFunction()); 
		configuration.setSharedVariable("mathAnd", new MathAndFunction()); 
		return configuration;
	}
}
